# -*- coding: utf-8 -*-
"""
Created on Sat Jul  4 07:23:28 2020

@author: Farman
"""

import pathlib
import sys

module_path = str(pathlib.Path(sys.argv[0]).parent.parent)

if sys.path.count(module_path) == 0:
    sys.path.append(module_path)

#print(sys.path)

import HdfMan

import pyhdf.SD as hdf

modis_file = r'D:\CUIT-Farman\Data\WuxiData\Wuxi-MODIS13Q1\2015\001\MOD13Q1.A2015001.h08v05.006.2015295101422.hdf'
dataset_name = '250m 16 days NDVI'

HdfMan.hdf_info(modis_file)
data = HdfMan.read_hdf(modis_file, dataset_name)


'''


hdf_obj = hdf.SD(modis_file)
data = hdf_obj.select(dataset_name).get()
hdf_obj.end()



#print(sum([sum(d==-3000) for d in data]))
'''
count = 0

for d in data:
    print('row', count, 'null values :',sum(d == -3000))
    count += 1

    
    
    
    
    
    
    
    
    
    